<layout name="page" />
<block name="content">
	{:widget('page_header/simple',array('name'=>'编辑日历事项'))}
	<form method='post' id="form_data" name="form_data" enctype="multipart/form-data"  >
		<input type="hidden" id="id" name="id" value="{$vo.id}">
		<input type="hidden" id="ajax" name="ajax" value="0">		
		<input type="hidden" id="opmode" name="opmode" value="edit">
		<input type="hidden" name="actor" id="actor" >
		
			<label class="input-label" for="name">标题*：</label>
			
				<input value="{$vo.name}" class="input" type="text" id="name" name="name" check="required" info="请输入标题">
			</div>
		</div>

		
			<label class="input-label" for="name">开始时间*：</label>
			
				<input value="{$vo.start_time|substr=0,16}" type="text" id="start_time" name="start_time" readonly="readonly" class="input input-date-time" check="required" info="请输入开始日期">				
			</div>
		</div>

		
			<label class="input-label" for="name">结束时间*：</label>
			
				<input value="{$vo.end_time|substr=0,16}" type="text" id="end_time" name="end_time" readonly="readonly"
				class="input input-date-time" check="eqt|start_time" info="请输入结束日期，需大于开始时间">				
			</div>
		</div>

		
			<label class="input-label" for="location">地点：</label>
			
				<input class="input" value="{$vo.location}" type="text" id="location" name="location">
			</div>
		</div>

		
			<label class="input-label" for="location">优先级：</label>
			
				<div class="input-static" >
					<input type="hidden" id="priority" name="priority"/>
					<div  class="slider_box" >
						<div class="left" >
							低
						</div>
						<div id="slider-range-priority"></div>
						<div class="right" >
							高
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class=""></div>
		
			<label class="input-label" for="location">参与人员：</label>
			
				<div id="actor_wrap" class="inputbox">
					<a class="pull-right btn btn-link text-center" onclick="popup_actor();"> <i class="fa fa-user"></i> </a>
					<div class="wrap" >
						<span class="address_list">{$vo.actor||show_contact="edit"}</span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
					</div>
					<div class="search dropdown ">
						<ul class="dropdown-menu"></ul>
					</div>
				</div>
			</div>
		</div>

		
			<label class="input-label" >附件：</label>
			
								{:widget('file_upload/edit',array('add_file'=>$vo['add_file']))}
			</div>
		</div>
		
			<div class="col-xs-12">
				<textarea  class="editor" id="content" name="content" style="width:100%;height:300px;">{$vo.content}</textarea>
			</div>
		</div>
		<div class="action form-actions">
			<a class="btn btn-normal" onclick="save()">保存</a>
			<a  class="btn btn-return" onclick="go_return_url();">取消</a>
		</div>
	</form>
</block>
<block name="js">
	<script type="text/javascript">
		function popup_actor() {
			winopen("{:url('popup/actor')}",560, 470);
		}

		function save() {
			$("#actor").val("");
			$("#actor_wrap span.address_list span").each(function() {
				$("#actor").val($("#actor").val() + $(this).text().replace(';', '') + '|' + $(this).attr("title") + ";");
			});
			send_form("form_data", "{:url('save')}");
		}

		$(document).ready(function() {
			$(document).on("click", ".inputbox .address_list a.del", function() {
				$(this).parent().parent().remove();
			});
			fill_time("start_time");
			fill_time("end_time");

			$("#start_time option[value='{$vo.start_time}']").attr("selected", "selected");
			$("#end_time option[value='{$vo.end_time}']").attr("selected", "selected");

			$("#priority").val("{$vo.priority}");
			$("#slider-range-priority").slider({
				range : "min",
				min : 1,
				max : 5,
				value : "{$vo.priority}",
				slide : function(event, ui) {
					$("#priority").val(ui.value);
					$("div.slider_box div.ui-slider").css("background-color", schedule_bg(ui.value));
					$("div.slider_box div.ui-widget-header").css("background-color", schedule_bg(ui.value));
				}
			});
			$("div.slider_box div.ui-slider").css("background-color", schedule_bg("{$vo.priority}"));
			$("div.slider_box div.ui-widget-header").css("background-color", schedule_bg("{$vo.priority}"));

		});
	</script>
</block>